﻿/* Write a program that reads two arrays from the console and compares them element by element. */

using System;
using System.Collections.Generic;

class CompareArrays
{
    static void Main()
    {
        Console.Write("How many elements?: ");
        int l = Int32.Parse(Console.ReadLine());
        int[] arr1 = new int[l];
        int[] arr2 = new int[l];
        
        //prompt for values & assign to memory
        for (int i = 0; i < l; i++)
        {
            Console.Write("Enter element {0} of array {1}: ", i+1, "arr1");
            arr1[i] = Int32.Parse(Console.ReadLine());
        }
        for (int i = 0; i < l; i++)
        {
            Console.Write("Enter element {0} of array {1}: ", i + 1, "arr2");
            arr2[i] = Int32.Parse(Console.ReadLine());
        }

        //compare
        for (int i = 0; i < l; i++)
        {
            if (arr1[i] == arr2[i]) Console.WriteLine("Elements with index {0} are equal! (value: {1})", i, arr1[i]);
            else Console.WriteLine("Elements with index {0} are not equal! (values: {1}, {2})", i, arr1[i], arr2[i]);
        }
    }
}
